package com.hq.erp.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hq.erp.mapper.ProductMapper;
import com.hq.erp.model.Product;
import com.hq.erp.service.ProductService;

@Service("productService")
@Transactional(readOnly=false)
public class ProductServiceImpl implements ProductService {
	
	@Autowired
	private ProductMapper productMapper;

	@Override
	public void saveProudct(Product product) {
		productMapper.insertProduct(product);

	}

	@Override
	public void editProudct(Product product) {
		productMapper.updateProduct(product);

	}

	@Override
	public void removeProudct(String productId) {
		productMapper.deleteProduct(productId);
	}

	@Override
	public Product getProudctById(String productId) {
		return productMapper.findProductById(productId);
	}

	@Override
	public List<Product> getProudcts() {
		return productMapper.findProducts();
	}

}
